home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Libraries / BlobMgr / Demo Folder / Window.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-21  |  1.3 KB  |  77 lines  |  [TEXT/KAHL]

  1. /*
  2.  * Blob Manager Demonstration:  Window routines
  3.  */
  4.  
  5. # include    "TransSkel.h"
  6.  
  7. # include    "BlobMgr.h"
  8. # include    "BlobDemo.h"
  9.  
  10.  
  11.  
  12. /*
  13.  * Get a window for a demo module.  Pass the resource number of the
  14.  * window.  Set the font to the System font, and add the window's
  15.  * title to the Windows menu.
  16.  *
  17.  * The window is created using a color GrafPort if possible so that
  18.  * better dimming can be done on monitors supporting grayscale.
  19.  */
  20.  
  21. WindowPtr
  22. GetDemoWind (short resNum)
  23. {
  24. WindowPtr    w;
  25.  
  26.     if (SkelQuery (skelQHasColorQD))
  27.         w = GetNewCWindow (resNum, nil, (WindowPtr) -1L);
  28.     else
  29.         w = GetNewWindow (resNum, nil, (WindowPtr) -1L);
  30.     SetPort (w);
  31.     TextFont (0);
  32.     TextSize (0);
  33.     return (w);
  34. }
  35.  
  36.  
  37. /*
  38.  * Generic window handler clobber proc for TransSkel stuff
  39.  */
  40.  
  41. pascal void
  42. DoWClobber (void)
  43. {
  44. WindowPtr    theWind;
  45.  
  46.     GetPort (&theWind);
  47.     DisposeWindow (theWind);
  48. }
  49.  
  50.  
  51. /*
  52.  * Set window's default blob dragging rects:  limit rect is portRect
  53.  * of window's grafPort, slop rect is wide open rectangle.
  54.  */
  55.  
  56. void 
  57. SetDragRects (GrafPtr thePort)
  58. {
  59. Rect    rSlop;
  60.  
  61.     SetRect (&rSlop, -30000, -30000, 30000, 30000);
  62.     SetBDragRects (&thePort->portRect, &rSlop);
  63. }
  64.  
  65.  
  66. /*
  67.  * Make a window the front window.
  68.  */
  69.  
  70. void
  71. MakeFrontWind (WindowPtr w)
  72. {
  73.     SelectWindow (w);
  74.     ShowWindow (w);
  75.     SkelDoEvents (updateMask + activMask);
  76. }
  77.